package ru.budget.mobile.di

import android.graphics.drawable.Drawable.ConstantState
import org.koin.dsl.module
import ru.budget.mobile.data.repository.ConsumptionRepositoryImpl
import ru.budget.mobile.data.repository.IncomeRepositoryImpl
import ru.budget.mobile.data.sources.ConsumptionLocalSource
import ru.budget.mobile.data.sources.IncomeLocalSource
import ru.budget.mobile.data.sources.local.ConsumptionLocalSourceImpl
import ru.budget.mobile.data.sources.local.IncomeLocalSourceImpl
import ru.budget.mobile.data.sources.local.room.BudgetDatabase
import ru.budget.mobile.domain.repository.ConsumptionRepository
import ru.budget.mobile.domain.repository.IncomeRepository

val dataModule = module {
    single <IncomeRepository> {
        IncomeRepositoryImpl(
            local = get<IncomeLocalSource>()
        )
    }

    single <IncomeLocalSource> {
        IncomeLocalSourceImpl(
            dao = get<BudgetDatabase>().incomeDAO()
        )
    }

    single <ConsumptionRepository> {
        ConsumptionRepositoryImpl(
            local = get<ConsumptionLocalSource>()
        )
    }

    single <ConsumptionLocalSource> {
        ConsumptionLocalSourceImpl(
            dao = get<BudgetDatabase>().consumptionDAO()
        )
    }
}